package kr.co.graviti.adm.common.vo;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import kr.co.graviti.common.util.CommonUtil;

public class AdmBbsVOToHashMap {
	
	/** VO to HashMap
	 * @param vo
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public HashMap bbsHashMapInfoMap(AdmBbsVO vo,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception{

		HashMap req = new HashMap();
		HttpSession session = request.getSession();
		
		req.put("lang", CommonUtil.strNullChk(vo.getLang(), ""));
		req.put("cmd", CommonUtil.strNullChk(vo.getCmd(), ""));
		req.put("userid", session.getAttribute("admId"));
		req.put("writer_ip", request.getRemoteAddr());
		req.put("board_idx", CommonUtil.intNullChk(Integer.toString(vo.getBoard_idx())));
		
		req.put("sbjt", CommonUtil.strNullChk(vo.getSbjt(), ""));
		req.put("related_date", CommonUtil.strNullChk(vo.getRelated_date(), ""));
		
		req.put("summary", CommonUtil.strNullChk(vo.getSummary(),""));
		req.put("cnts", CommonUtil.strNullChk(vo.getCnts(),""));
		
		req.put("top_notice_yn", CommonUtil.strNullChk(vo.getTop_notice_yn(), "N"));
		req.put("show_yn", CommonUtil.strNullChk(vo.getShow_yn(), "Y"));
		
		req.put("thread_idx", CommonUtil.intNullChk(Integer.toString(vo.getThread_idx())));
		req.put("depth", CommonUtil.intNullChk(Integer.toString(vo.getDepth())));
		req.put("post_start_date", CommonUtil.strNullChk(vo.getPost_start_date(), ""));
		req.put("post_end_date", CommonUtil.strNullChk(vo.getPost_end_date(), ""));
		req.put("etc01", CommonUtil.strNullChk(vo.getEtc01(), ""));
		req.put("etc02", CommonUtil.strNullChk(vo.getEtc02(), ""));
		req.put("etc03", CommonUtil.strNullChk(vo.getEtc03(), ""));
		req.put("etc04", CommonUtil.strNullChk(vo.getEtc04(), ""));
		
		//return url param
		req.put("currentPage", CommonUtil.strNullChk(vo.getCurrentPage(), "1"));
		req.put("currentGroup", CommonUtil.strNullChk(vo.getCurrentGroup(), "1"));
		req.put("searchkind", CommonUtil.strNullChk(vo.getSearchkind(), ""));
		req.put("searchword", CommonUtil.strNullChk(vo.getSearchword(), ""));
		
		/* 첨부파일 TYPE */
		req.put("imgFile_type", CommonUtil.strNullChk(vo.getImgFile_type(), ""));
		req.put("thumfile_type", CommonUtil.strNullChk(vo.getThumfile_type(), ""));
		req.put("upfile_type", CommonUtil.strNullChk(vo.getUpfile_type(), ""));
		
		req.put("thum_idx", CommonUtil.strNullChk(vo.getThum_idx(),""));
		req.put("thum_del", CommonUtil.strNullChk(vo.getThum_del(),""));
		
		req.put("attch_file_idx", CommonUtil.intNullChk(Integer.toString(vo.getAttch_file_idx())));
		
		
		return req;
	}
}
